package br.com.news.business;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import br.com.news.business.utils.GenericBusiness;
import br.com.news.utils.business.exception.BusinessException;
import br.com.news.utils.business.interfaces.IFonteBusiness;
import br.com.news.utils.database.beans.FonteBean;
import br.com.news.utils.database.exception.DataBaseServiceException;
import br.com.news.utils.database.interfaces.IFonteServiceDb;

@Named
public class FonteBusiness extends GenericBusiness implements IFonteBusiness{

	@Inject
	private IFonteServiceDb fonteServiceDb;
	
	@Override
	public List<FonteBean> findAll() throws BusinessException {
		try {
			return fonteServiceDb.findAll();
		} catch (DataBaseServiceException e) {
			throw new BusinessException(e);
		}
	}

	@Override
	public FonteBean buscaPorNome(String descricao) {
		return fonteServiceDb.buscaPorNome(descricao);
	}

}
